package com.slz3.business.module.wmsManagement.wmsWarehouseManage.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsWarehouseManage.domain.WmsWarehouseManage;
import com.slz3.business.module.wmsManagement.wmsWarehouseManage.domain.WmsWarehouseManageFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsWarehouseManageTransactionalServiceImpl implements WmsWarehouseManageTransactionalService {

    @Override
    public WmsWarehouseManage modify(WmsWarehouseManage wmsWarehouseManageNew) {
        Repositorys.wmsWarehouseManage.test();
        Repositorys.wmsWarehouseManage.save(WmsWarehouseManageFactory.initBaseFields());
        System.err.println(1 / 0);
        wmsWarehouseManageNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsWarehouseManage.saveAndFlush(wmsWarehouseManageNew);
    }

    @Override
    public List<WmsWarehouseManage> batchModify(List<WmsWarehouseManage> wmsWarehouseManageList) {
        return Repositorys.wmsWarehouseManage.saveAll(wmsWarehouseManageList);
    }
}
